<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ page import="java.util.Locale" %>


<fmt:bundle basename="StripesResources" /> 
<fmt:message key='menu.play' var="play" />
<s:layout-render name="layout.jsp" nadpis="${play}">

    <s:layout-component name="telo">
        <s:useActionBean beanclass="cz.muni.fi.pa165.hauntedhouses.rest.web.PlayActionBean" var="actionBean"/>
        <s:errors/>
        <br />
        <s:form beanclass="cz.muni.fi.pa165.hauntedhouses.rest.web.PlayActionBean">
            <c:choose>
                <c:when test="${fn:length(actionBean.humans) == 0}">
                    <div><font style="color: red"><fmt:message key="play.nohumansforhouse"/></font></div><br/>
                </c:when>
                <c:otherwise>
                    <fmt:message key="play.selecthuman"/>
                    <table class="zakladni">
                        <tr>
                            <th></th>
                            <th><fmt:message key="play.name"/></th>
                            <th><fmt:message key="play.psyche"/></th>
                            <th><fmt:message key="play.description"/></th>
                        </tr>
                        <c:forEach items="${actionBean.humans}" var="human">
                            <tr>
                                <td style="width: 15px;">
                                    <s:radio name="human.id" value="${human.id}" />
                                </td>

                                <td><c:out value="${human.name}"/></td>
                                <td><c:out value="${human.psyche}"/></td>
                                <td><c:out value="${human.description}"/></td>

                            </tr>
                        </c:forEach>
                    </table>
                </c:otherwise>
            </c:choose>
            <br /><br />
            <c:choose>
                <c:when test="${fn:length(actionBean.abilities) == 0}">
                    <div><font style="color: red"><fmt:message key="play.noabilitiesforghost"/></font></div><br/>
                </c:when>
                <c:otherwise>
                    <fmt:message key="play.selectability"/>
                    <table class="zakladni">

                        <tr>
                            <th></th>
                            <th><fmt:message key="admin.abilityName"/></th>
                            <th><fmt:message key="admin.abilityDamage"/></th>
                            <th><fmt:message key="admin.abilityLevel"/></th>
                            <th><fmt:message key="admin.abilityType"/></th>
                            <th><fmt:message key="admin.abilityDescription"/></th>
                        </tr>
                        <c:forEach items="${actionBean.abilities}" var="ability">
                            <tr>
                                <td style="width: 15px;">
                                    <s:radio name="ability.id" value="${ability.id}" />
                                </td>
                                <td><c:out value="${ability.name}"/></td>
                                <td><c:out value="${ability.damage}"/></td>
                                <td><c:out value="${ability.abilityLevel}"/></td>
                                <td><c:out value="${ability.abilityType}"/></td>                    
                                <td><c:out value="${ability.description}"/></td>
                            </tr>
                        </c:forEach>
                    </table>
                </c:otherwise>
            </c:choose>
            <br />
            <s:hidden name="ghost.id" />
            <s:hidden name="house.id" />
            
            <s:submit style="width: 210px;height: 30px" name="play">
                <fmt:message key="menu.back"/>
            </s:submit>
            <s:submit style="width: 210px;height: 30px" name="play3">
                <fmt:message key="menu.play"/>
            </s:submit>

        </s:form>
    </s:layout-component>
</s:layout-render>
